home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
bbs
/
cddk9606.zip
/
HEADERS.ARJ
/
FOSSIL.INT
< prev
next >
Wrap
Text File
|
1996-06-14
|
12KB
|
417 lines
{ ───────────────────────────────────────────────────────────────────────── }
{ FOSSIL: Fido/Opus/Seadog Standard Interface Layer support }
{ Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide }
{ ───────────────────────────────────────────────────────────────────────── }
UNIT FOSSIL;
{$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
{$F+} { . . . . . . . . . . . . . . . . . . . . Force far calls for safety }
{$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
{$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
{$Q-} { . . . . . . . . . . . . . . Do not generate overflow-checking code }
{$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
{$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
{$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
INTERFACE
CONST
{ Baud rates }
_300 = $00 + $40 + $00; { 010----- }
_600 = $00 + $40 + $20; { 011----- }
_1200 = $80 + $00 + $00; { 100----- }
_2400 = $80 + $00 + $20; { 101----- }
_4800 = $80 + $40 + $00; { 110----- }
_9600 = $80 + $40 + $20; { 111----- }
_19200 = $00 + $00 + $00; { 000----- }
_38400 = $00 + $00 + $20; { 001----- }
{ Communications ports }
_COM1 = $00;
_COM2 = $01;
_COM3 = $02;
_COM4 = $03;
{ FOSSIL status constants }
RDA = $01; { AH 00000001 }
OVRN = $02; { AH 00000010 }
THRE = $20; { AH 00100000 }
TSRE = $40; { AH 01000000 }
DCD = $80; { AL 10000000 }
{ Flow control constants }
XON_XOFF_Transmit = 1;
RTS_CTS = 2;
DSR_DTR = 4;
XON_XOFF_Receive = 8;
TYPE
FOSSIL_Info_Type = RECORD
Size : Word; { Size of structure in bytes }
Spec : Byte; { Conforms to this specification }
Version : Byte; { Version of this driver }
ASCII_ID : Pointer; { Far pointer to ASCII ID string }
IBSize : Word; { Size of inbound buffer }
IBFree : Word; { No. of bytes left in inbound buffer }
OBSize : Word; { Size of outbound buffer }
OBFree : Word; { No. of bytes left in outbound buffer }
Width : Byte; { Width of screen on adapter }
Height : Byte; { Height of screen on adapter }
Baud : Byte; { Baud code, per function 03h (see below) }
END;
{ The ASCII_ID string is null-terminated and will not contain a }
{ newline character. The baud field uses the same format used }
{ by function 03h. Port-specific fields are undefined if the }
{ port is FFh or invalid. }
{#Start}
FUNCTION MakeBaudCode(Baud:LongInt):Byte;
{
PURPOSE : Constructs a baud-rate code using 8N1 settings.
NOTES : Bits 7, 6 and 5 of the result specify the baud rate:
010 = 300
011 = 600
100 = 1200
101 = 2400
110 = 4800
111 = 9600
000 = 19200 (replaces old 110 baud mask)
001 = 38400 (replaces old 150 baud mask)
Bits 4 and 3 define the parity:
0 0 = No parity
1 0 = No parity
0 1 = Odd parity
1 1 = Even parity
Bit 2 defines the stop bits:
0 = 1 stop bit
1 = 1.5 bits for 5-bit characters, 2 for others
Bits 1 and 0 define the character length:
0 0 = 5 bits/character
0 1 = 6 bits/character
1 0 = 7 bits/character
1 1 = 8 bits/character
This procedure assumes 8N1 (eight bits per character, no
parity, one stop bit).
SEE ALSO : FOSSIL_Set_Baud
}
PROCEDURE FOSSIL_Set_Baud(FOSSIL_Port:Word; Code:Byte);
{
PURPOSE : Sets the baud rate for the specified port.
NOTES : 000 00 0 00
│ │ │ └─ Character length
│ │ └──── Stop bits
│ └────── Parity
└───────── Baud rate
Refer to MakeBaudCode for an explanation of these bits.
SEE ALSO : MakeBaudCode
}
PROCEDURE FOSSIL_Xmit_Chr(FOSSIL_Port:Word; C:Char);
{
PURPOSE : Transmits a character.
NOTES : The procedure will not return until there is room in the
outbound buffer.
SEE ALSO : FOSSIL_Block_Write, FOSSIL_Read_Chr, FOSSIL_Xmit_Chr_No_Wait,
FOSSIL_Xmit_Str
}
PROCEDURE FOSSIL_Read_Chr(FOSSIL_Port:Word; VAR C:Char);
{
PURPOSE : Reads a character from the FOSSIL driver.
NOTES : The procedure will not return until a character is available
in the inbound buffer.
SEE ALSO : FOSSIL_Char_Waiting, FOSSIL_Peek, FOSSIL_Xmit_Chr
}
FUNCTION FOSSIL_Carrier_Detect(FOSSIL_Port:Word):Boolean;
{
PURPOSE : Returns TRUE if a caller is online; FALSE if not.
}
FUNCTION FOSSIL_Char_Waiting(FOSSIL_Port:Word):Boolean;
{
PURPOSE : Returns TRUE if a character is waiting in the inbound buffer.
SEE ALSO : FOSSIL_Read_Chr
}
FUNCTION FOSSIL_Init(FOSSIL_Port:Word):Boolean;
{
PURPOSE : Initializes the FOSSIL driver.
NOTES : The function must be called before any other communications
routines are called. Returns TRUE if a FOSSIL driver is
installed; FALSE if one was not detected.
SEE ALSO : FOSSIL_DeInit
}
PROCEDURE FOSSIL_DeInit(FOSSIL_Port:Word);
{
PURPOSE : Deinitializes the FOSSIL driver.
NOTES : You should call this procedure when exiting the program.
DTR is not affected (carrier is not dropped).
SEE ALSO : FOSSIL_Init
}
PROCEDURE FOSSIL_Lower_DTR(FOSSIL_Port:Word);
{
PURPOSE : Lowers the DTR line to the modem.
SEE ALSO : FOSSIL_Raise_DTR
}
PROCEDURE FOSSIL_Raise_DTR(FOSSIL_Port:Word);
{
PURPOSE : Raises the DTR line to the modem.
SEE ALSO : FOSSIL_Lower_DTR
}
{#Pause}
FUNCTION FOSSIL_Timer_Int:Byte;
FUNCTION FOSSIL_Ticks_Per_Second:Byte;
FUNCTION FOSSIL_MS_Per_Tick:Word;
{#Resume}
PROCEDURE FOSSIL_Flush_Output(FOSSIL_Port:Word);
{
PURPOSE : Transmits any data still in the outbound buffer.
NOTES : Control will not be returned until all of the data has been
sent.
SEE ALSO : FOSSIL_Purge_Input, FOSSIL_Purge_Output
}
PROCEDURE FOSSIL_Purge_Output(FOSSIL_Port:Word);
{
PURPOSE : Discards any data in the outbound buffer.
SEE ALSO : FOSSIL_Flush_Output, FOSSIL_Purge_Input
}
PROCEDURE FOSSIL_Purge_Input(FOSSIL_Port:Word);
{
PURPOSE : Discards any data in the inbound buffer.
SEE ALSO : FOSSIL_Flush_Output, FOSSIL_Purge_Output
}
FUNCTION FOSSIL_Xmit_Chr_No_Wait(FOSSIL_Port:Word; C:Char):Boolean;
{
PURPOSE : Attempts to transmit a character.
NOTES : The function returns TRUE if room was available in the
outbound buffer; FALSE if not.
SEE ALSO : FOSSIL_Block_Write, FOSSIL_Xmit_Chr, FOSSIL_Xmit_Str
}
FUNCTION FOSSIL_Peek(FOSSIL_Port:Word):Char;
{
PURPOSE : Returns the next character in the inbound buffer without
removing that character from the buffer.
NOTES : FFh (#255) is returned if no characters are in the buffer.
SEE ALSO : FOSSIL_Read_Chr
}
{#Pause}
PROCEDURE FOSSIL_Read_Key_No_Wait(VAR C:Char);
PROCEDURE FOSSIL_Read_Key(VAR C:Char);
{ These two procedures provide access to the IBM keyboard. }
{ FOSSIL_Read_Key waits until a key is available in the keyboard buffer. }
{ FOSSIL_Read_Key_No_Wait returns immediately with FFh (#255) if }
{ a key has not been pressed. }
PROCEDURE FOSSIL_Flow_Control(FOSSIL_Port:Word; Mask:Byte);